
const { options } = require('../models/index');
class Options {
  static async add(ctx) {
    const { request: { body } } = ctx;
    if (!body.cid || !body.name) {
      ctx.body = {
        status: false,
        message: "缺少必填字段!"
      }
      return
    }
    ctx.body = await options.add(body);
  }
  static async list(ctx) {
    const { params: { cid } } = ctx;
    if (cid < 1 || cid > 3) {
      ctx.body = {
        status: false,
        message: "类型ID不正确!"
      }
      return
    }
    ctx.body = await options.list(cid);
  }
}
module.exports = Options;